package com.yin.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yin.pojo.*;
import com.yin.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class TestController {
    @Autowired
    private TestService testService;
    @Autowired
    private BigdataService bigdataService;
    @Autowired
    private InformationsecurityService informationsecurityService;
    @Autowired
    private OperationService operationService;
    @Autowired
    private SoftwareengineeringService softwareengineeringService;

    @RequestMapping("/from/Bigdata")
    public List<Bigdata> bigdata(){
        List<Bigdata> bglist = bigdataService.list(null);
        return bglist;
    }
    @RequestMapping("/from/InformationSecurity")
    public List<Informationsecurity> InformationSecurity(){
        List<Informationsecurity> infolist = informationsecurityService.list(null);
        return infolist;
    }
    @RequestMapping("/from/Softwareengineering")
    public List<Softwareengineering> Softwareengineering(){
        List<Softwareengineering> solist = softwareengineeringService.list(null);
        return solist;
    }
    @RequestMapping("/from/Operation")
    public List<Operation> Operation(){
        List<Operation> oplist = operationService.list(null);
        return oplist;
    }

    //ajax URL get数据来源
    @RequestMapping("/from/{name}")
    public List<Test> List2(@PathVariable("name") String name){
        QueryWrapper<com.yin.pojo.Test> wrapper = new QueryWrapper<>();
        List<com.yin.pojo.Test> list = testService.list(wrapper.like("jname", name)
                .or().like("ctype", name)
                .or().like("jname", name)
                .or().like("tag",name));
        return list;
    }
}
